<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<!-- 编辑器 -->

<script type="text/javascript">

$(function(){
	/* var kindEditor;
	kindEditor = KindEditor.create($("#context"), {
		width:'100%',
		height:'500px',
		resizeType :0,//2或1或0，2时可以拖动改变宽度和高度，1时只能改变高度，0时不能拖动。
		langType : 'zh_CN',
	    allowUpload : true, //允许上传图片
	    uploadJson : '${BASE_PATH}/web/notice/uploadimg',//指定上传文件的服务器端程序。
		items : [
			'source','|','fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
			'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
			'insertunorderedlist', '|', 'image', 'link'], 
		afterCreate : function() {this.sync();}, 
	    afterBlur:function() {this.sync();} 
	 });  */
	//初始化表单验证
	$("#editForm").validate({
		ignore: "",
		rules:{link:{url:true}}, 
		messages:{
			title: {required: "请输入标题"},
			describe: {required: "请输入概要"},
			type: {required: "请选择分类"},
			link: {required: "请输入链接"}
		},
		submitHandler:function(form){
			$(form).ajaxSubmit({
				success:function(data){
					switch(data.flag){
					case -1:
						Kit.alert("网络繁忙...，请重试");return;
					case 0:
						dataPaginator.loadPage(1);
						editDialog.close();
					}
				}
			});
		}
	});
});

</script>
<form id="editForm" action="${BASE_PATH}/web/notice/doEdit" method="post" class="form-horizontal" >
	<div class="form-group">
	    <label class="col-lg-2 control-label">标题</label>
	    <div class="col-lg-9">
        	<input type="text" name="title" value="${object.title}" class="form-control" placeholder="请输入标题" required maxlength="36">
        	<input type="hidden" name="noticeid" value="${object.id}"/>
	    </div>
	</div>
	<div class="form-group">
	    <label class="col-lg-2 control-label">描述</label>
	    <div class="col-lg-9">
        	<input type="text" name="describe" value="${object.describe}" class="form-control" placeholder="请输入概要" required maxlength="36">
	    </div>
	</div>
	<div class="form-group">
	    <label class="col-lg-2 control-label">类型</label>
	    <div class="col-lg-9">
	    	<select name="type" class="selectpicker form-control" required>
				<option value="1" <c:if test="${object.type ==1 }">selected</c:if> >公告</option>
				<option value="2" <c:if test="${object.type ==2 }">selected</c:if> >活动</option>
				<option value="3" <c:if test="${object.type ==3 }">selected</c:if> >服务消息</option>
	        </select>
	    </div>
	</div>
	<div class="form-group">
	    <label class="col-lg-2 control-label">是否展示</label>
	    <div class="col-lg-9">
			<input type="radio" class="radioItem" id="s1" name="show" value="1" <c:if test="${object.show ==1 }">checked="checked"</c:if> />是
			<input type="radio" class="radioItem" id="s2" name="show" value="2" <c:if test="${object.show ==2 }">checked="checked"</c:if> />否
		</div>
	</div>
	<div class="form-group">
	    <label class="col-lg-2 control-label">内容</label>
	    <div class="col-lg-9">
        	<input type="text" name="detail" value="${object.detail}" class="form-control" placeholder="请输入消息内容" required maxlength="500">
	    </div>
	</div>
	<div class="form-group">
	    <label class="col-lg-2 control-label">连接</label>
	    <div class="col-lg-9">
        	<input type="text" name="link" value="${object.link}" class="form-control" placeholder="请输入链接地址" maxlength="200" required>
	    </div>
	</div>
	<div class="row">
		<div class="col-lg-6"><button class="btn btn-primary col-sm-3 pull-right" type="submit" autocomplete="off">提交</button></div>
		<div class="col-lg-6"><button class="btn btn-default col-sm-3 pull-left" type="button" onclick="javascript:editDialog.close();" autocomplete="off">取消</button></div>
	</div>
</form>